import Axios from '../utils/axios'
import api from '../api'

// 获取角色列表
function getRoleList() {
    return Axios.get(api.settings.ROLE_SELECT)
}

// 添加角色列表
function addRole(name: string) {
    return Axios.post(api.settings.ROLE_INSERT, { name })
}

// 获取角色数据回显
function getRoleById(id: number) {
    return Axios.get(api.settings.ROLE_GET_BY_ID + id)
}

// 修改角色列表
function updateRole(obj: any) {
    return Axios.post(api.settings.ROLE_UPDATE, obj)
}

// 删除角色列表
function deleteRole(id: number) {
    return Axios.get(api.settings.ROLE_DELETE_ID, { params: { id } })
}

export default {
    getRoleList,
    addRole,
    updateRole,
    deleteRole,
    getRoleById,
}